<?php
#include_once "lib/ezsql/shared/ez_sql_core.php";
#include_once "lib/ezsql/mysql/ez_sql_mysql.php";
$DB_USER="root";
$DB_PASS="test";
$DB_NAME="cta";
$DB_HOST="localhost";
$ADM="admin";
$ADM_PWD="password";
$READ_NUM=100;
$UPLOAD_DIR="../upload_dir/";

try {
	$dsn_conn=sprintf("mysql:host=%s;dbname=%s",$DB_HOST,$DB_NAME);
	$dbh = new PDO($dsn_conn,$DB_USER,$DB_PASS);
} catch (PDOException $e) {
   print "Error!: " . $e->getMessage() . "<br/>";
   die();
}
/* set initial encoding */
$dbh->query("SET NAMES utf8");

function up_file($f,$renameto,$U_A="../upfile_dir/")
{

	if(is_uploaded_file($f['tmp_name']) && ($f['size']>0))
	{					
		$upload_dir=$U_A;
		$filename=explode('.',$f['name']);					
		$up_name=$renameto.".".array_pop($filename);
		move_uploaded_file($f['tmp_name'],$upload_dir.$up_name);
		return $up_name;
	}
	
}

function del_file($delname){
		
		if(file_exists($delname)&& !is_dir($delname)){
			@unlink($delname);
		}
}
function htmlspecialchars_decode_php4 ($str) {
    return strtr($str, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
}

function generatorPassword()
{
    $password_len = 10;
    $password = '';

    // remove o,0,1,l
    $word = 'abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789';
    $len = strlen($word);

    for ($i = 0; $i < $password_len; $i++) {
        $password .= $word[rand() % $len];
    }

    return $password;
}
?>
